Skip to content

fix: allow null in User::setIdentities() - #1383

Merged
datamweb merged 1 commit into
codeigniter4:developfrom
wakqasahmed:fix/issue-1302-nullable-set-identities
Oct 9, 2026
Merged

datamweb merged 1 commit into
codeigniter4:developfrom
wakqasahmed:fix/issue-1302-nullable-set-identities

Conversation

@wakqasahmed

Copy link
Copy Markdown
Contributor

Description

Fixes #1302

$identities is ?array and null is what tells getIdentities() to reload from the database, but setIdentities() only accepted array. So in a subclass of User, where the private property isn't reachable, $this->identities = null goes through the entity setter and throws a TypeError. Same for $user->identities = null from outside.

As discussed in the issue, this changes the signature to setIdentities(?array $identities), and adds a test that setting identities to null makes the next read pick up a newly added identity.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@datamweb datamweb added the bug Something isn't working label Oct 3, 2026
@datamweb

datamweb commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Congratulations on your first contribution to Shield, @wakqasahmed!
Thank you for getting involved and helping move the project forward.

@datamweb
datamweb merged commit 4dfa429 into codeigniter4:develop Oct 9, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Assigning null to ?array $identities property without proper handling

3 participants